package net.com.hydroPK.net;

import net.com.hydroPK.Engine;

/*
* 
* @author Canownueasy
*
*/

public class Monitor implements Runnable {
    /* Varibles */
    public static final boolean restart = true;
    public static final int timer = 120;

    public void Restarter() {
        if (Engine.getPlayerCount() == 0) {
            (new Thread(this)).start();
        }
    }

    public void run() {
        try {
            Thread.sleep(timer * 300);
        } catch (Exception e) {
        }
        System.out.println("[SERVER] 0 users online. The server has suspected a server crash.");
        System.out.println("[SERVER] Server restarted.");
        try {
            Thread.sleep(200);
        } catch (Exception e) {
        }
        try {
            Thread.sleep(200);
        } catch (Exception e) {
        }
        try {
            Thread.sleep(200);
        } catch (Exception e) {
        }
        System.exit(0);
    }
}